package com.tbdp.lsmp.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.parser.ParserConfig;
import com.alibaba.fastjson.serializer.SerializeConfig;

/**
 * @author xbkaishui
 * @version $Id: JsonUtil.java, v 0.1 2017-11-05 下午1:42 xbkaishui Exp $$
 */
public class JsonUtil {

    /**
     * 序列化配置类对象
     */
    private static final SerializeConfig serializeConfig = new SerializeConfig();

    /**
     * 反序列化配置类对象
     */
    private static final ParserConfig parserConfig = new ParserConfig();

    static {
        serializeConfig.propertyNamingStrategy = PropertyNamingStrategy.CamelCase;
        parserConfig.propertyNamingStrategy = PropertyNamingStrategy.CamelCase;
    }


    public static String toJsonString(Object obj) {
        return JSON.toJSONString(obj, serializeConfig);
    }

}


